package sing.sleuth.consumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author xing
 * @date 2022/8/23 18:24
 */
@RestController
public class SleuthConsumerController {

    private final RestTemplate restTemplate;

    public SleuthConsumerController(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    @GetMapping("zipkin")
    public String consumeZipkin() {
        String url = "http://localhost:8001/zipkin";
        return restTemplate.getForObject(url, String.class);
    }
}
